package com.csu.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyGlobalCorsConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")  // 拦截所有的请求
//                .allowedOrigins("http://172.20.10.5:5173")
                .allowedOriginPatterns("*") // 移除这行
                .allowCredentials(true)
                .allowedMethods("*")
                .allowedHeaders("*");
    }
}